<?php js_validate();?>
<form action="<?php echo $own_links;?>save" id="form-validated" enctype="multipart/form-data" method="post" style="padding:10px; background-color:#FF9; margin-bottom:10px; border:2px solid #FC3;">
<input type="hidden" name="kd_id" id="kd_id" value="" />
	Client 
    <select name="asuransi" id="asuransi" class="validate[required]">
    	<?php if(count($asuransi['data']) > 0){
				foreach($asuransi['data'] as $r){
			?>
            	<option value="<?php echo $r->pa_id;?>"><?php echo $r->pa_name;?></option>
            <?php 
				}
		}
		?>
    </select>
    &raquo;
    Bulan 
    <select name="bulan" id="bulan">
    	<?php for($i=1;$i<=12;$i++){?>
        	<option value="<?php echo ($i<=9)?"0".$i:$i;?>"><?php echo ($i<=9)?"0".$i:$i;?></option>
        <?php } ?>
    </select>
    <select name="tahun" id="tahun">
    	<?php for($i=date("Y");$i>=2000;$i--){?>
        	<option value="<?php echo $i;?>"><?php echo $i;?></option>
        <?php } ?>
    </select>
    &raquo;
    File <input type="file" name="excel_file" style="padding:5px;" id="excel_file" />
    
    <input type="submit" name="btnupload" class="btn-simpan" value="Upload" />
</form>
<div class="clr"></div>
<?php if(isset($data)){ ?>
<div style=" padding:4px; background-color:#FF9; border:2px solid #FC3; margin-bottom:5px; font-size:14px;">
<div style="float:left;">
<h3 style="font-size:20px;"><?php echo isset($data)?getClientName($data->kd_pa):'';?></h3>
<h4><?php
	$b = explode("-",$data->kd_bulan);
	echo "Bulan : ".$this->bulan[$b[1]];
	echo ", Tahun : ".$b[0];

?></h4>
<h2> <?php echo 'test'."$p" ?>  </h2>
</div>
<div  style="float:right; width:270px; margin-top:12px;">
	<a href="<?php echo $own_links;?>hapus_data" class="btn-simpan confirm" rel="Yakin Akan menghapus data ini ?" style="padding:10px; text-decoration:none;"> Hapus Data ? </a>
    <a href="<?php echo $own_links;?>approve_data" class="btn-simpan confirm" rel="Yakin Akan Mengapprove data Ini ?" style="padding:10px; margin-left:20px; text-decoration:none;"> Approve Data ? </a>
</div>
<div class="clr"></div>
</div>
<?php } ?>
<?php if(isset($items) && count($items) > 0){ ?>
<div style=" padding:4px; background-color:#FF9; border:2px solid #FC3; margin-bottom:5px; font-size:14px;">
<h2 style="font-size:15px; float:left;">Total Data : <?php echo count($items);?> data</h2>
<?php
	$jumlah = 0;
	foreach($items as $m){
		$jumlah += $m->detail_sub_premi;
	}
?>
<h2 style="font-size:15px; float:right;">Total Premi : <?php echo myNum($jumlah);?></h2>
<div class="clr"></div>
</div>
<div class="clr"></div>
<?php } ?>

<table class="data">
	<tr>
		<th>No</th>  
        <th>Nama</th>
        <th>Alamat</th>
        <th>Tgl Lahir</th>
        <th>Tgl Akad</th>
        <th>Usia</th>
        <th>Periode Pertanggungan</th>
        <th>Jangka Waktu < 65 thn</th>
        <th>Jangka Waktu > 65 thn</th>   
        <th>Premi Usia 40-65</th>   
        <th>Premi Usia 66-75</th> 
        <th>Nilai Kredit</th>      
        <th>Premi</th>
	</tr>
    <?php if(isset($items) && count($items) > 0){
			$no=1;
			foreach($items as $r){
		?>
     		<tr>
            	<td><?php echo $no++;?></td>
                <td><?php echo $r->detail_nama;?></td>
                <td><?php echo $r->detail_alamat;?></td>
                <td><?php echo myDate($r->detail_tgllahir,"d/m/Y",false);?></td>
                <td><?php echo myDate($r->detail_tglakad,"d/m/Y",false);?></td>
                <td align="center"><?php echo $r->detail_usia;?> Thn</td>
                <td align="center"><?php echo $r->detail_periode_tgj;?> Thn</td>
                <td align="center"><?php echo $r->detail_jwp1;?> Thn</td>
                <td  align="center"><?php echo $r->detail_jwp2;?> Thn</td>
                <td><?php echo myNum($r->detail_rate_pu1);?></td>
                <td><?php echo myNum($r->detail_rate_pu2);?></td>
                <td><?php echo myNum($r->detail_nilai_kredit);?></td>
                <td><?php echo myNum($r->detail_sub_premi);?></td>
            </tr>   
    <?php } 
	}
	?>
</table>
